import { Column, Entity , BaseEntity, PrimaryGeneratedColumn, CreateDateColumn, UpdateDateColumn} from "typeorm";

@Entity("user_info")
export class UserInfoEntity extends BaseEntity {
  
  /**
   * @PrimaryGeneratedColumn 定义一个自增的主键列
   * 
   * @Column  普通的数据列 默认不可以为空
   *          nullable : 可以为空
   *          type:类型
   *          readonly : 只读 第等
   * @CreateDateColumn 自动记录实体的创建时间
   * 
   * @UpdateDateColumn 自动记录实体的更新时间
   */
  // 主键
  @PrimaryGeneratedColumn()
  id: number;

  @Column()
  name: string;

  @Column({nullable:true})
  age: number;

  @Column({nullable:true})
  sex: string;

  @Column({nullable:true})
  email: string;

  @Column({unique:true})
  phone: string;

  @Column({nullable:true})
  address: string;

  @CreateDateColumn({
    type:'timestamp',
    name:'create_time'
  })
  createTime: Date;

  @UpdateDateColumn({
    type:'timestamp',
    name:'update_time'
  })
  updateTime: Date;
  
}